﻿Imports ReglasNegocio
Imports System.Collections.Generic
Imports System.Data

Partial Public Class Bandeja_Empleados_Excel
    Inherits System.Web.UI.Page
    Protected strFechaActual As String
    Protected strHoraActual As String
    Protected ParamDNI, ParamAPAT, ParamAMAT, ParamNOM, ParamLOC, ParamEST, ParamINI, ParamFin, ParamNomEstado, ParamNomLocal As String
    Protected dsConsulta As New DataSet

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Put user code to initialize the page here
        Response.Expires = 0
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1")
        Response.ContentType = "application/xls"
        Response.AppendHeader("Content-disposition", "attachment; filename=Reporte_Empleados.xls")
        SRT_RecuperacionFechas()
        CargaGrillaEmpleados(PreviousPage.DNIExcel, PreviousPage.ApePaternoExcel, PreviousPage.ApeMaternoExcel, PreviousPage.NombresExcel, PreviousPage.CodLocalExcel, PreviousPage.CodEstadoExcel, PreviousPage.InicioExcel, PreviousPage.FinExcel)
    End Sub
    Private Sub SRT_RecuperacionFechas()
        strFechaActual = Format(DateTime.Now.Date, "dd/MM/yyyy")
        Dim minuto As String
        If DateTime.Now.Minute < 10 Then
            minuto = "0" & DateTime.Now.Minute
        Else
            minuto = DateTime.Now.Minute
        End If
        strHoraActual = DateTime.Now.Hour & ":" & minuto
    End Sub

    Private Sub CargaGrillaEmpleados(ByVal pstrDNI As String, ByVal pstrAPAT As String, ByVal pstrAMAT As String, ByVal pstrNombre As String, ByVal pstrLocal As String, ByVal pstrEstado As String, ByVal pstrInicio As String, ByVal pstrFin As String)
        ParamDNI = (pstrDNI)
        ParamAPAT = UCase(pstrAPAT)
        ParamAMAT = UCase(pstrAMAT)
        ParamNOM = UCase(pstrNombre)
        ParamLOC = UCase(pstrLocal)
        ParamEST = UCase(pstrEstado)
        ParamINI = UCase(pstrInicio)
        ParamFin = UCase(pstrFin)
        Dim Catalogo As CatalogoEmpleado = New CatalogoEmpleado()
        dsConsulta = Catalogo.ListaEmpleados(pstrDNI, pstrAPAT, pstrAMAT, pstrNombre, pstrLocal, pstrEstado, pstrInicio, pstrFin)
        ParamNomEstado = PreviousPage.NomEstadoExcel
        ParamNomLocal = PreviousPage.NomLocalExcel
    End Sub

End Class